#include "ItemBody.h"


ItemBody::ItemBody(QWidget *parent):
    QFrame(parent)
{
    initUI();
}

void ItemBody::setName(const QString &name)
{
    des->setText(name);
}

void ItemBody::setStatus(WorkStatus selected)
{
    switch (selected) {
    case NOT:
        light->Close();
        break;
    case OK:
        light->Open();
        break;
    case ING:
        light->Blink(true);
        break;
    case FINISH:
        light->Open();
        break;
    }
}

void ItemBody::initUI()
{
    light = new QLight;
    des = new QLabel;
    QHBoxLayout *layout = new QHBoxLayout();
    des->setText("adsdsds");
    layout->addWidget(des);
    layout->addStretch();
    layout->addWidget(light);
    this->setLayout(layout);
}
